<include file="Public/common1" />

<block name="content">
    <div class="page-header"><h1>会员管理 &gt;会员列表</h1></div>
    <form action="" id="form">
        <div class="col-xs-12 clearfix">
            <div class="col-xs-4">
                <label for="visitor_name" class="col-xs-4">会员姓名</label>
                <div class="col-xs-8"><input type="text" name="visitor_name" id="visitor_name" value="<if condition="$_GET['visitor_name']">{$_GET['visitor_name']}</if>" class="form-control" /></div>
            </div>
            <div class="col-xs-4">
                <label for="visitor_phone" class="col-xs-4">联系方式</label>
                <div class="col-xs-8"><input name="visitor_phone" id="visitor_phone" value="<if condition="$_GET['visitor_phone']">{$_GET.visitor_phone}</if>"  type="text" class="form-control" /></div>
            </div>
            <div class="col-xs-4">
                <label for="" class="col-xs-4">消费次数大于</label>
                <div class="col-xs-8"><input min="0" type="number" name="consume_num" id="consume_num" value="<if condition="$_GET['consume_num']">{$_GET.consume_num}</if>" class="form-control" /></div>
            </div>
        </div>

        <div class="col-xs-12 clearfix mt-15">
            <div class="col-xs-4">
                <label for="s_entry_time" class="col-xs-4">下单时间</label>
                <div class="col-xs-4"><input type="text" name="s_entry_time" id="start" value="<if condition="$_GET['s_entry_time']">{$_GET.s_entry_time}</if>" class="form-control" /></div>
                <div class="col-xs-4"><input type="text" name="e_entry_time" id="end" value="<if condition="$_GET['e_entry_time']">{$_GET.e_entry_time}</if>" class="form-control" /></div>
            </div>

            <div class="col-xs-2">
                <button type="button" onclick="exportExcel()" class="btn btn-primary" style="margin-right:10px">导出</button>
                <button type="submit" class="btn btn-primary" >查询</button>
            </div>

        </div>


    </form>

    <table class="table table-striped  table-bordered table-hover table-condensed  mt-15">
        <thead>
            <tr>
                <th>会员姓名</th>
                <th>性别</th>
                <th>联系方式</th>
                <th>下单时间</th>
                <th>销售人</th>
                <th>累计消费次数</th>
                <th>历史消费金额</th>
                <th>累计积分</th>
            </tr>
        </thead>
        <tbody>
            <foreach name="list" item="v">
                <tr>
                    <td>{$v['visitor_name']}</td>
                    <td>{$v['visitor_sex']}</td>
                    <td>{$v['visitor_phone']}</td>
                    <td>{$v['entry_time']}</td>
                    <td>{$v['sale_man']}</td>
                    <td>{$v['consume_num']}</td>
                    <td>{$v['total_consumption']}</td>
                    <td>{$v['total_score']}</td>
                </tr>
            </foreach>
        </tbody>
    </table>
    <ul class="pagination pull-right">{$show}</ul>
</block>
<block name="js">
<script src="__JS__/jedate/jedate.js"></script>
<script>
function exportExcel () {
    var $form = $('#form');
    $form.attr('action', '/Reseller/Visitor/visitor_list/exprotExcel/1');
    $form.submit();
    $form.attr('action', '')
}

 /**
 * 绑定日期选择器
 * @param  {[obj]}    obj        [元素]
 * @param  {[string]} dateFormat [时间格式]
 */
function dateFormat(obj, dateFormat){
    jeDate({
        dateCell: '#'+$(obj).attr('id'),
        format: dateFormat,
        isinitVal:false,
        isTime:true, //isClear:false,
        okfun:function(val){
        }
    });
}
dateFormat($('#start'), 'YYYY-MM-DD');
dateFormat($('#end'), 'YYYY-MM-DD');
</script>
</block>
